package com.eastfair.pay.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.boot.service.SuperService;
import com.eastfair.pay.dto.ChinaumsLogDTO;
import com.eastfair.pay.dto.PaymentDTO;
import com.eastfair.pay.dto.TransactionOrderDTO;
import com.eastfair.pay.dto.TransactionOrderPageQuery;
import com.eastfair.pay.entity.TransactionOrder;
import com.eastfair.pay.vo.TransactionOrderVO;

import java.util.List;

/**
 * <p>
 * 业务接口
 * 交易订单
 * </p>
 *
 * @author fwl
 * @date 2023-03-13
 */
public interface TransactionOrderService extends SuperService<TransactionOrder> {
    /**
     * do转vo
     *
     * @param model
     */
    TransactionOrderVO doToVo(TransactionOrder model);

    /**
     * do转vo
     *
     * @param modelList
     */
    List<TransactionOrderVO> doToVos(List<TransactionOrder> modelList);


    /**
     * 通用查询
     *
     * @param modelDTO DTO
     * @param ids      主键id集合
     * @return list
     */
    List<TransactionOrder> list(TransactionOrderDTO modelDTO, List<Long> ids);

    /**
     * @return TransactionOrder
     * @Author fwl
     * @Description //通过orderNum查询订单
     * @Date 15:09 2023/3/22
     * @Param [orderNum]
     **/
    TransactionOrder getByOrderNum(String orderNum);

    /**
     * 通用查询
     *
     * @param modelDTO DTO
     * @param ids      主键id集合
     * @return list
     */
    List<TransactionOrder> listOfCache(TransactionOrderDTO modelDTO, List<Long> ids);

    /**
     * @return void
     * @Author fwl
     * @Description //保存更新
     * @Date 16:48 2023/3/13
     * @Param [transactionOrderDTO]
     **/
    void saveOrUpdate(TransactionOrderDTO transactionOrderDTO);

    /**
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.eastfair.pay.vo.TransactionOrderVO>
     * @Author fwl
     * @Description //交易记录分页查询
     * @Date 17:11 2023/3/13
     * @Param [params]
     **/
    Page<TransactionOrderVO> queryList(PageParams<TransactionOrderPageQuery> params);


    /**
     * @return void
     * @Author fwl
     * @Description //保存
     * @Date 14:12 2023/3/17
     * @Param [transactionOrderDTO]
     **/
    boolean save(TransactionOrderDTO transactionOrderDTO);

    /**
     * @return void
     * @Author fwl
     * @Description //更新
     * @Date 14:12 2023/3/17
     * @Param [transactionOrderDTO]
     **/
    void updateById(TransactionOrderDTO transactionOrderDTO);

    /**
     * @return void
     * @Author fwl
     * @Description //取消交易订单
     * @Date 14:12 2023/3/17
     * @Param [orderNum]
     **/
    void cancel(String orderNum);

    /**
     * 将没有交易流水号的订单同步荆艺
     * @param orderNumList
     */
    void executeSyncOrderToJY(List<String> orderNumList);

    /**
     * 交易详情查询
     *
     * @param id
     * @param orderType
     * @return
     */
    List<TransactionOrder> queryTransactionOrderDetails(Long id, String orderType);

    /**
     * 在线支付
     *
     * @param dto
     * @param chinaumsLog
     * @return
     */
    Boolean onlinePayment(PaymentDTO dto, ChinaumsLogDTO chinaumsLog);

    /**
     * 通过订单号查询 交易订单详情
     *
     * @param orderNum
     * @return
     */
    TransactionOrderVO queryOrderDetailsByOrderNum(String orderNum);

    /**
     * 更新订单交易状态
     *
     * @param transactionOrderDTO
     */
    void updateOrderStatus(TransactionOrderDTO transactionOrderDTO);

    void checkPayStatus(Long id);

    boolean batchSave(List<TransactionOrderDTO> transactionOrderList);
}
